import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/index.vue'

import speechRouter from './modules/speech'
import radarRouter from './modules/radar'
import smokeRoute from './modules/smoke'
import voiceRoute from './modules/voice'

export const constantRoutes = [
    {
      // path: '/index',
      // name:'首页',
      // component: HomeView,
      path: '/',
      redirect: '/index',
      // component: HomeView,
      children:[{
        path: '/index',
        name:'首页',
        component: HomeView,
      }]
    }, 
    // {
    //   path: '/index',
    //   name:'首页',
    //   component: HomeView,
    // },
    {
      path: '/main',
      name: 'main',
      component: () => import('../views/main.vue')
    },
    // {
    //   path: '/voice',
    //   name: 'voice',
    //   component: () => import('../views/voice/index.vue')
    // },
    // {
    //   path: '/radar',
    //   name: 'radar',
    //   component: () => import('../views/radar/index.vue')
    // },
    // {
    //   path: '/smoke',
    //   name: 'smoke',
    //   component: () => import('../views/smoke/index.vue')
    // }
]
export const asyncRoutes = [speechRouter,
  radarRouter,smokeRoute,voiceRoute
] 

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
//   // routes: [...constantRoutes, ...asyncRoutes]
  routes: constantRoutes
})

asyncRoutes.forEach(item => {
  router.addRoute(item)
})

export default router
